Skip to content

Conversation

ayushb
Copy link
Member

@ayushb ayushb commented Sep 11, 2026

Solves #8

  • add favorites model in src/models/favorites.ts that stores pokemon IDs in localStorage (same favorites key as before, so existing data still works)
  • validate stored data and drop invalid or duplicate IDs
  • add useFavorites hook in src/controllers/ that keeps state and storage in sync
  • make Favorite a presentational component with isFavorite and onToggle props, add aria-pressed
  • wire the hook into App.tsx
  • add tests for the model, the hook and the component (incl. snapshot)

The FavoritePokemon list can get its data from useFavorites().favorites when everything is connected in #6.

* Add favorites model that stores pokemon IDs in localStorage
* Validate stored data and drop invalid or duplicate IDs
* Add useFavorites hook that keeps state and local storage in sync
* Make Favorite a presentational component with isFavorite and onToggle props
* Wire the hook into App and add tests for model, hook and component

References #8
@ayushb ayushb requested a review from a team as a code owner September 11, 2026 08:31
Copy link
Member

@thomhet thomhet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thomhet thomhet merged commit 5dfe89f into main Sep 13, 2026
@thomhet thomhet deleted the feat/favorites-model branch September 13, 2026 20:38
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants